﻿using System.Collections.Generic;
using System.Web;
using System.Xml.Linq;
using System.Linq;
using CharacterCreation.Business.ViewModels;
using CharacterCreation.Data.Models;

namespace CharacterCreation.Business.Repositories
{
    public class SkillRepository : Repository<VMSkill, Skill>
    {
        public void Initialize()
        {
            List<VMSkill> skills = new List<VMSkill>();
            XDocument xmldoc = XDocument.Load(HttpContext.Current.Server.MapPath("~/Content/Data/Skill.xml"));
            foreach (XElement element in xmldoc.Elements().Elements())
            {
                skills.Add(ObjectMapper.Parse<VMSkill>(element));
            }
            this.Add(skills);
        }
    }
}
